package org.example.proxy.jdk;

/**
 * @author : RXK
 * Date : 2021/5/27 10:42
 * Code Less Think More
 * Desc:
 * 静态代理 实现与被代理类 相同的接口 内部实例化被代理的对象，隐藏代理对象
 */
public class StaticProxy implements HelloService {

    private final HelloService target;


    public StaticProxy() {
        this.target = new HelloServiceImpl();
    }


    @Override
    public String sayHello(String name) {
        System.out.println("i'm proxy");
        return target.sayHello(name);
    }

    @Override
    public String sayHello(String firstName, String secondName) {
        return target.sayHello(firstName,secondName);
    }
}
